﻿/*
* @Author： whg
* @Date : 2021-1-19
* @Desc : 
*/
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XNodeEditor;
[XNodeEditor.NodeEditor.CustomNodeEditor(typeof(MainRoleNode))]
public class MainRoleEditor : NodeEditor
{
    private MainRoleNode node;
    public override void OnBodyGUI()
    {
        serializedObject.Update();
        if (node == null) node = target as MainRoleNode;

        NodeEditorGUILayout.PortField(target.GetInputPort("upLink"));
        EditorGUILayout.Space();
        EditorGUIUtility.labelWidth = 105;
        NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("mainRoleType"));
        switch (node.mainRoleType)
        {
            case MainRoleNode.MainRoleType.MainRoleMove:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("moveType"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("move_last"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("move_target"));
                break;
            case MainRoleNode.MainRoleType.MainRoleRotate:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("rotateType"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("rotate_angle"));
                break;
            case MainRoleNode.MainRoleType.MainRolePlay:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("play_time"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("play_content"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("play_head_use"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("play_recover"));
                break;
            case MainRoleNode.MainRoleType.MainRoleRide:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("ride_bool"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("ride_time"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("ride_ins_id"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("ride_bone"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("ride_anim"));
                break;
            case MainRoleNode.MainRoleType.MainRoleJumpRide:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("jumpRide_bool"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("jumpRide_time"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("jumpRide_ins_id"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("jumpRide_anim"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("jumpRide_peak"));
                break;
            case MainRoleNode.MainRoleType.MainRoleShadow:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("shadow_bool"));
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("shadow_target"));
                break;
            case MainRoleNode.MainRoleType.MainRoleMatrix:
                NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("matrix"));
                break;
        }
        NodeEditorGUILayout.PortField(target.GetOutputPort("downLink"));
        serializedObject.ApplyModifiedProperties();
    }
    public override int GetWidth()
    {
        return 220;
    }
}
